﻿CREATE FUNCTION [dbo].[RATExByAfPmt](
	@AF float,@PMT float,@Term smallint,@OpenDate smalldatetime,@FstDueDate smalldatetime,@PmtsPerYear tinyint,@DayCountConvention tinyint
)RETURNS float WITH SCHEMABINDING
BEGIN

IF 0 IN (ISNULL(@AF,0),ISNULL(@Term,0),ISNULL(@PMT,0)) RETURN 0

IF @AF < 0 RETURN 0

RETURN dbo.RATExByPaymentFactor(@AF/@PMT,@PmtsPerYear,@Term,@OpenDate,@FstDueDate,@DayCountConvention)
END

